package com.hmk.edu.mvcframework.pojo;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

/**
 * @className: Handler
 * @Description: TODO 存储封装handler处理方法相关信息
 * @author: Huangjianyun
 * @date: 2022/3/23 13:21
 */
public class Handler {
    private  Object controller;  // method.invode(obj,) handler方法所在类

    private Method method;

    private Pattern pattern; //spring的url支持正则的  匹配url

    private Map<String,Integer> paramIndexMapping; //参数的顺序 是为了进行参数绑定 key:参数名  value:参数位置

    public Handler(Object controller, Method method, Pattern pattern) {
        this.controller = controller;
        this.method = method;
        this.pattern = pattern;
        this.paramIndexMapping = new HashMap<>();
    }

    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }

    public Map<String, Integer> getParamIndexMapping() {
        return paramIndexMapping;
    }

    public void setParamIndexMapping(Map<String, Integer> paramIndexMapping) {
        this.paramIndexMapping = paramIndexMapping;
    }


}
